home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / os2 / nftp102.zip / INSTALL.CMD < prev    next >
OS/2 REXX Batch file  |  1997-04-16  |  6KB  |  202 lines

  1. /* REXX */
  2.  
  3. /* Load RexxUtil extensions */
  4. if RxFuncQuery("SysLoadFuncs") then do
  5.     say "loading RexxUtil extensions..."
  6.     call RxFuncAdd "SysLoadFuncs","RexxUtil","SysLoadFuncs"
  7.     if result \= "0" then do
  8.         say "error loading RexxUtil.dll"
  9.         exit
  10.     end
  11.     call SysLoadFuncs
  12. end
  13.  
  14. /* ask user about directories etc. */
  15. Call SysCls
  16. say
  17. say "NFTP Version 1.00 installation"
  18. say
  19. say "This script will do the following:"
  20. say "1) copy required files into the directory you specified;"
  21. say "2) set up default settings in nftp.ini"
  22. say "3) create objects on your desktop"
  23. say
  24.  
  25. numlangs = 15
  26. lang.1  = "English   "
  27. lang.2  = "Russian   "
  28. lang.3  = "Chinese   "
  29. lang.4  = "Spanish   "
  30. lang.5  = "Swedish   "
  31. lang.6  = "Hungarian "
  32. lang.7  = "German    "
  33. lang.8  = "Danish    "
  34. lang.9  = "Japanese  "
  35. lang.10 = "Norwegian "
  36. lang.11 = "Italian   "
  37. lang.12 = "Brazilian "
  38. lang.13 = "Dutch     "
  39. lang.14 = "French    "
  40. lang.15 = "Bulgarian "
  41.  
  42. choose_language:
  43.     
  44. say "Enter no. of language you wish to install:"
  45. say
  46. do i = 1 to numlangs by 3
  47.     i1 = i + 1
  48.     i2 = i + 2
  49.     say right(i,2)")" lang.i "    " right(i1,2)")" lang.i1 "    " right(i2,2)")" lang.i2
  50. end
  51. say
  52. say "Empty line entered will abort installation."
  53. parse pull langno .
  54. if langno = "" then exit
  55. if (langno > numlangs) | (langno < 1) then do
  56.     say "The number you entered is outside of range"
  57.     say
  58.     signal choose_language
  59. end
  60. language = lang.langno
  61.  
  62. say
  63. say "Enter destination directory (where NFTP files will be installed)."
  64. say "If you wish to install NFTP into the subtree (eg, ""d:\apps\tcpip\nftp"")"
  65. say "you have to create upper directory first (""d:\apps\tcpip"" in the"
  66. say "above example). Enter ""."" to install into the current directory."
  67. say "Empty line entered will abort installation."
  68. say
  69. parse pull destpath .
  70. if destpath = "" then exit
  71.  
  72. destpath = strip(destpath, "T", "\")
  73. dlpath = strip(dlpath, "T", "\")
  74.  
  75. /* verify choices */
  76. call SysCls
  77. say "Installing NFTP into the directory :" destpath
  78. say "NFTP language                      :" language
  79. say
  80. say "Press Ctrl-C to abort or any other key to continue"
  81. say
  82. '@pause >nul'
  83. Call SysCls
  84.  
  85. /* creating target directories if necessary */
  86. if destpath <> "." then
  87. do
  88.     call SysFileTree destpath, "srch", "D"
  89.     if srch.0 = 0 then do
  90.         rc = SysMkDir(destpath)
  91.         if rc <> 0 then do
  92.             say "Fatal error: cannot create directory" destpath
  93.             exit
  94.         end
  95.     end
  96. end
  97.     
  98. /* copying NFTP files */
  99. if destpath <> "." then
  100. do
  101.     '@copy * 'destpath' >nul'
  102.     say "Files were copied to" destpath
  103. end
  104.  
  105. if destpath = "." then destpath = directory()
  106. if dlpath = "." then dlpath = directory()
  107.     
  108. /* making sure we will not overwrite existing nftp.mrk */
  109. if stream(destpath"\nftp.bmk", "C", "QUERY EXISTS") == "" then
  110.    if stream(destpath"\nftp.mrk", "C", "QUERY EXISTS") <> "" then
  111.       call bmkconv destpath"\nftp.mrk" destpath"\nftp.bmk"
  112.    else
  113.      '@copy nftp.bm 'destpath'\nftp.bmk >nul'
  114.  
  115. /* checking 'nftp.ini' presence */
  116. newinifile = destpath"\nftp.ini"
  117. if stream(destpath"\nftp.ini", "C", "QUERY EXISTS") <> "" then 
  118. do
  119.     say
  120.     say destpath"\nftp.ini already exists."
  121.     say "It will be renamed to nftp.bak and new nftp.ini will be"
  122.     say "created; all your customizations are now transferred"
  123.     say "automatically."
  124.     '@pause'
  125.     call SysFileDelete destpath"\nftp.bak"
  126.     "@rename" destpath"\nftp.ini nftp.bak"
  127.     call updini destpath"\nftp.bak" destpath"\nftp.ini" directory()"\nftp.i"
  128. end
  129. else
  130. do
  131.     /* creating new 'nftp.ini' and customizing it slightly */
  132.     call SysFileDelete newinifile
  133.     signal off notready
  134.     say
  135.     say "Enter default path for downloads (e.g., ""d:\tmp"")."
  136.     say "This directory should reside on HPFS drive or you'll be unable"
  137.     say "to download files which are not 8.3-compliant."
  138.     say "You may skip it (current directory will be used for downloads)."
  139.     parse pull dlpath .
  140.  
  141.     if (dlpath <> ".") & (dlpath <> "") then
  142.     do
  143.         call SysFileTree dlpath, "srch", "D"
  144.         if srch.0 = 0 then do
  145.             rc = SysMkDir(dlpath)
  146.             if rc <> 0 then do
  147.                 say "Fatal error: cannot create directory" dlpath
  148.                 exit
  149.             end
  150.         end
  151.     end
  152.     
  153.     say
  154.     say "Enter your e-mail address (to be used as a password for anonymous logins):"
  155.     parse pull email .
  156.     if email = "" then exit
  157.  
  158.     do forever
  159.         lin = linein("nftp.i")
  160.         newlin = lin
  161.         if substr(lin,1,20) = ';anonymous-password=' then
  162.             newlin = 'anonymous-password="'email'"'
  163.         if substr(lin,1,20) = ';log-transfers-name=' then
  164.             newlin = 'log-transfers-name="'destpath'\nftp.fls"'
  165.         if substr(lin,1,23) = ';default-download-path=' then
  166.             newlin = 'default-download-path="'dlpath'"'
  167.         if substr(lin,1,16) = ';bookmarks-file=' then
  168.             newlin = 'bookmarks-file="'destpath'\nftp.bmk"'
  169.         rc = lineout(newinifile, newlin)
  170.         if lin = "" & left(stream("nftp.i"),5) <> "READY" then leave
  171.     end
  172.     call stream "nftp.i", "C", "CLOSE"
  173.     call stream newinifile, "C", "CLOSE"
  174. end
  175.  
  176. /* creating nftp.cmd */
  177.  
  178. cmdfile = destpath"\nftp.cmd"
  179. call SysFileDelete cmdfile    
  180. rc = lineout(cmdfile, "@set NFTP_LANG="strip(left(language,7)))
  181. rc = lineout(cmdfile, "@"destpath"\nftp.exe %1 %2 %3 %4 %5 %6")
  182. call stream cmdfile, "C", "CLOSE"
  183.  
  184. '@pause'
  185. Call SysCls
  186.  
  187. call makeobjs destpath
  188.  
  189. /* looks like we're done... */
  190. say
  191. say "Installation complete."
  192. say "You can customize "destpath"\nftp.ini according your preferences."
  193. say
  194. say "If you don't have EMX runtime support installed, copy emx.dll into"
  195. say "any directory specified in your LIBPATH. File 'emx.dll' provided"
  196. say "with NFTP version 1.00 has version number ""0.9c, fixlevel 2""."
  197. say "Read NFTP documentation about obtaining complete EMX runtime support"
  198. say "package and its source code."
  199. say
  200. '@pause'
  201. Exit
  202.